import 'dart:math';

import 'package:flutter/material.dart';
import 'package:flutter_custompaint_first/Widget/chart/BarChartPainter.dart';
/**
 * Create by laoge
 * on 2021/4/26 0026
 */

class BarChart extends StatefulWidget {

  @override
  _BarChart createState() {
    return _BarChart();
  }

}


class _BarChart extends State<BarChart> with TickerProviderStateMixin {

  Map<dynamic,int> data ={};

  @override
  void initState() {
    // TODO: implement initState
    data.clear();
    for(int i=0;i<6;i++){
      data["${i}a"] = (Random().nextInt(180));
    }
    super.initState();
  }

  @override
  Widget build(BuildContext context) {

    return Container(
        child: CustomPaint(
          painter: BarChartPainter(context, data),
        ),
    );
  }
}
